require('./other.css');
const DOM = require('./other.html');

let box = document.createElement('div');
box.id = '#box';
box.innerHTML = DOM;

let body = document.getElementsByTagName('body')[0];

if (body.children[0]) {
  body.insertBefore(box, body.children[0]);
} else {
  body.appendChild(box);
}

let liLists = $('.foot').find('ul li');
let liWidth = Math.floor(100 / liLists.length) + '%';
liLists.css({ width: liWidth });

var payLevel = $("input[name='money_type']:checked").val();

var Page = function() {
  this.isInit = false;
};

Page.prototype.init = function() {
  this.isInit = true;
};

var page1 = new Page();

var ChangeLanguage = function() {};

ChangeLanguage.prototype.init = function() {
  Page.prototype.init.call(this);
};

var changeLanguage1 = new ChangeLanguage();

changeLanguage1.init();

console.log(page1);

var abv={
  name:'abv'
}

var vvv={
  name:'vvv'
}

var bb =function(){
  console.log(this.name)
}

bb.call(abv)
bb.call(vvv)

var foo1=function(){
  this.name='foo1'
}

var foo2=function(){
  this.name='foo2'

}

foo1.prototype.name=function(){
  console.log(this.name)
}

foo2.prototype.name=function(){
  console.log(this.name)
}

foo1.prototype.name();
foo1.prototype.name.call(foo2.prototype)
foo2.prototype.name();

var Tinker = function() {
  this.elements = [];
};

Tinker.fn = Tinker.prototype = {
  constructor: Tinker,
  extend: function(obj) {
    var p;
    for (p in obj) {
      //此处若看明白了, 那么前面的就理解了
      this.constructor.prototype[p] = obj[p];
    }
  }
};

Tinker.fn.extend({
  get: function() {
    var length = arguments.length,
      i = 0;
    for (; i < length; i++) {
      //此处若看明白了, 那么前面的就理解了
      this.elements.push(document.getElementById(arguments[i]));
    }
    //此处若看明白了, 那么前面的就理解了
    return this;
  },
  each: function(fn) {
    var i = 0,
      length = this.elements.length;
    for (; i < length; i++) {
      fn.call(this.elements[i], i, this.elements[i]);
    }
    //此处若看明白了, 那么前面的就理解了
    return this;
  }
});

var obj = new Tinker();
console.log(obj);
